package com.ruoyi.applet.controller;

import java.util.List;
import java.io.IOException;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;

import com.ruoyi.applet.utli.TokenByUsrId;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.log.enums.BusinessType;
import com.ruoyi.common.security.annotation.RequiresPermissions;
import com.ruoyi.applet.domain.Address;
import com.ruoyi.applet.service.IAddressService;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.utils.poi.ExcelUtil;
import com.ruoyi.common.core.web.page.TableDataInfo;

/**
 * 地址Controller
 * 
 * @author ruoyi
 * @date 2024-12-04
 */
@RestController
@RequestMapping("/applet")
public class AddressController extends BaseController
{
    @Resource
    private IAddressService addressService;

    @RequestMapping("/usrAddress")
    public Object selectUsrAddress(@RequestParam("token") String token){
        return addressService.selectAllByAddressUsrId(TokenByUsrId.tokenByUsrId(token));
    }

    @RequestMapping("/addressList")
    public Object selectUserAddressList(@RequestParam("token") String token){
        return addressService.selectAllByAddressUsrIdList(TokenByUsrId.tokenByUsrId(token));
    }

    @RequestMapping("/editAddress")
    public Object editAddress(@RequestParam("token") String token,@RequestParam("addressId") Long addressId){
        return addressService.selectAllByAddressUsrIdAddress(TokenByUsrId.tokenByUsrId(token),addressId);
    }
}
